function record = set(record,varargin)
% SET Set SinkToFile properties to the specified values
% and return the updated object

propertyArgIn = varargin;
while length(propertyArgIn) >= 2
    prop = propertyArgIn{1};
    val = propertyArgIn{2};
    propertyArgIn = propertyArgIn(3:end);
    switch prop
        case 'time'
            record.time = val;
        case 'mean'
            record.mean = val;
        case 'var'
            record.var  = val;
        case 'repeat'
            record.repeat = repeat;
        case 'VariableName'
            record.VariableName = val;
        case 'VariableUnit'
            record.VariableUnit = val;
        otherwise
            error('Undefined field');
    end
end